3.16.40 \(\int \sec (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx\) [1540]

3.16.40.1 Optimal result
3.16.40.2 Mathematica [A] (verified)
3.16.40.3 Rubi [A] (verified)
3.16.40.4 Maple [A] (verified)
3.16.40.5 Fricas [A] (verification not implemented)
3.16.40.6 Sympy [F]
3.16.40.7 Maxima [A] (verification not implemented)
3.16.40.8 Giac [A] (verification not implemented)
3.16.40.9 Mupad [B] (verification not implemented)

3.16.40.1 Optimal result

Integrand size = 29, antiderivative size = 94 \[ \int \sec (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=-\frac {(a+b)^2 (A+B) \log (1-\sin (c+d x))}{2 d}+\frac {(a-b)^2 (A-B) \log (1+\sin (c+d x))}{2 d}-\frac {b (A b+2 a B) \sin (c+d x)}{d}-\frac {b^2 B \sin ^2(c+d x)}{2 d} \]

output
-1/2*(a+b)^2*(A+B)*ln(1-sin(d*x+c))/d+1/2*(a-b)^2*(A-B)*ln(1+sin(d*x+c))/d 
-b*(A*b+2*B*a)*sin(d*x+c)/d-1/2*b^2*B*sin(d*x+c)^2/d
 
3.16.40.2 Mathematica [A] (verified)

Time = 0.14 (sec) , antiderivative size = 81, normalized size of antiderivative = 0.86 \[ \int \sec (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=-\frac {(a+b)^2 (A+B) \log (1-\sin (c+d x))-(a-b)^2 (A-B) \log (1+\sin (c+d x))+2 b (A b+2 a B) \sin (c+d x)+b^2 B \sin ^2(c+d x)}{2 d} \]

input
Integrate[Sec[c + d*x]*(a + b*Sin[c + d*x])^2*(A + B*Sin[c + d*x]),x]
 
output
-1/2*((a + b)^2*(A + B)*Log[1 - Sin[c + d*x]] - (a - b)^2*(A - B)*Log[1 + 
Sin[c + d*x]] + 2*b*(A*b + 2*a*B)*Sin[c + d*x] + b^2*B*Sin[c + d*x]^2)/d
 
3.16.40.3 Rubi [A] (verified)

Time = 0.34 (sec) , antiderivative size = 100, normalized size of antiderivative = 1.06, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.172, Rules used = {3042, 3316, 27, 657, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \sec (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(a+b \sin (c+d x))^2 (A+B \sin (c+d x))}{\cos (c+d x)}dx\)

\(\Big \downarrow \) 3316

\(\displaystyle \frac {b \int \frac {(a+b \sin (c+d x))^2 (A b+B \sin (c+d x) b)}{b \left (b^2-b^2 \sin ^2(c+d x)\right )}d(b \sin (c+d x))}{d}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {\int \frac {(a+b \sin (c+d x))^2 (A b+B \sin (c+d x) b)}{b^2-b^2 \sin ^2(c+d x)}d(b \sin (c+d x))}{d}\)

\(\Big \downarrow \) 657

\(\displaystyle \frac {\int \left (-A b-B \sin (c+d x) b-2 a B+\frac {b \left (A a^2+2 b B a+A b^2\right )+b \left (B a^2+2 A b a+b^2 B\right ) \sin (c+d x)}{b^2-b^2 \sin ^2(c+d x)}\right )d(b \sin (c+d x))}{d}\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {\left (a^2 A+2 a b B+A b^2\right ) \text {arctanh}(\sin (c+d x))-\frac {1}{2} \left (a^2 B+2 a A b+b^2 B\right ) \log \left (b^2-b^2 \sin ^2(c+d x)\right )-b (2 a B+A b) \sin (c+d x)-\frac {1}{2} b^2 B \sin ^2(c+d x)}{d}\)

input
Int[Sec[c + d*x]*(a + b*Sin[c + d*x])^2*(A + B*Sin[c + d*x]),x]
 
output
((a^2*A + A*b^2 + 2*a*b*B)*ArcTanh[Sin[c + d*x]] - ((2*a*A*b + a^2*B + b^2 
*B)*Log[b^2 - b^2*Sin[c + d*x]^2])/2 - b*(A*b + 2*a*B)*Sin[c + d*x] - (b^2 
*B*Sin[c + d*x]^2)/2)/d
 

3.16.40.3.1 Defintions of rubi rules used

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 657
Int[(((d_.) + (e_.)*(x_))^(m_.)*((f_.) + (g_.)*(x_))^(n_.))/((a_) + (c_.)*( 
x_)^2), x_Symbol] :> Int[ExpandIntegrand[(d + e*x)^m*((f + g*x)^n/(a + c*x^ 
2)), x], x] /; FreeQ[{a, c, d, e, f, g, m}, x] && IntegersQ[n]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3316
Int[cos[(e_.) + (f_.)*(x_)]^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_ 
.)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Simp[1/(b^p* 
f)   Subst[Int[(a + x)^m*(c + (d/b)*x)^n*(b^2 - x^2)^((p - 1)/2), x], x, b* 
Sin[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, m, n}, x] && IntegerQ[(p - 1) 
/2] && NeQ[a^2 - b^2, 0]
 
3.16.40.4 Maple [A] (verified)

Time = 0.76 (sec) , antiderivative size = 125, normalized size of antiderivative = 1.33

method result size
parallelrisch \(\frac {\left (8 A a b +4 B \,a^{2}+4 B \,b^{2}\right ) \ln \left (\sec ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-4 \left (a +b \right )^{2} \left (A +B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+4 \left (a -b \right )^{2} \left (A -B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+B \cos \left (2 d x +2 c \right ) b^{2}+\left (-4 A \,b^{2}-8 B a b \right ) \sin \left (d x +c \right )-B \,b^{2}}{4 d}\) \(125\)
derivativedivides \(\frac {A \,a^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )-B \,a^{2} \ln \left (\cos \left (d x +c \right )\right )-2 A a b \ln \left (\cos \left (d x +c \right )\right )+2 B a b \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+A \,b^{2} \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+B \,b^{2} \left (-\frac {\left (\sin ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )}{d}\) \(131\)
default \(\frac {A \,a^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )-B \,a^{2} \ln \left (\cos \left (d x +c \right )\right )-2 A a b \ln \left (\cos \left (d x +c \right )\right )+2 B a b \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+A \,b^{2} \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+B \,b^{2} \left (-\frac {\left (\sin ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )}{d}\) \(131\)
norman \(\frac {-\frac {2 B \,b^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {2 B \,b^{2} \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {2 b \left (A b +2 B a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {4 b \left (A b +2 B a \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {2 b \left (A b +2 B a \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{3}}+\frac {\left (2 A a b +B \,a^{2}+B \,b^{2}\right ) \ln \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {\left (A \,a^{2}-2 A a b +A \,b^{2}-B \,a^{2}+2 B a b -B \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {\left (A \,a^{2}+2 A a b +A \,b^{2}+B \,a^{2}+2 B a b +B \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) \(263\)
risch \(2 i A a b x -\frac {i {\mathrm e}^{-i \left (d x +c \right )} A \,b^{2}}{2 d}+i x B \,a^{2}-\frac {i {\mathrm e}^{-i \left (d x +c \right )} B a b}{d}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{d}+\frac {\cos \left (2 d x +2 c \right ) B \,b^{2}}{4 d}-\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A a b}{d}+\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B a b}{d}-\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A a b}{d}-\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B a b}{d}+\frac {i {\mathrm e}^{i \left (d x +c \right )} A \,b^{2}}{2 d}+\frac {2 i B \,a^{2} c}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A \,a^{2}}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A \,b^{2}}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B \,b^{2}}{d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A \,a^{2}}{d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A \,b^{2}}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B \,a^{2}}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B \,b^{2}}{d}+\frac {2 i B \,b^{2} c}{d}+\frac {4 i A a b c}{d}+i B \,b^{2} x +\frac {i {\mathrm e}^{i \left (d x +c \right )} B a b}{d}\) \(407\)

input
int(sec(d*x+c)*(a+b*sin(d*x+c))^2*(A+B*sin(d*x+c)),x,method=_RETURNVERBOSE 
)
 
output
1/4*((8*A*a*b+4*B*a^2+4*B*b^2)*ln(sec(1/2*d*x+1/2*c)^2)-4*(a+b)^2*(A+B)*ln 
(tan(1/2*d*x+1/2*c)-1)+4*(a-b)^2*(A-B)*ln(tan(1/2*d*x+1/2*c)+1)+B*cos(2*d* 
x+2*c)*b^2+(-4*A*b^2-8*B*a*b)*sin(d*x+c)-B*b^2)/d
 
3.16.40.5 Fricas [A] (verification not implemented)

Time = 0.30 (sec) , antiderivative size = 111, normalized size of antiderivative = 1.18 \[ \int \sec (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=\frac {B b^{2} \cos \left (d x + c\right )^{2} + {\left ({\left (A - B\right )} a^{2} - 2 \, {\left (A - B\right )} a b + {\left (A - B\right )} b^{2}\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left ({\left (A + B\right )} a^{2} + 2 \, {\left (A + B\right )} a b + {\left (A + B\right )} b^{2}\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (2 \, B a b + A b^{2}\right )} \sin \left (d x + c\right )}{2 \, d} \]

input
integrate(sec(d*x+c)*(a+b*sin(d*x+c))^2*(A+B*sin(d*x+c)),x, algorithm="fri 
cas")
 
output
1/2*(B*b^2*cos(d*x + c)^2 + ((A - B)*a^2 - 2*(A - B)*a*b + (A - B)*b^2)*lo 
g(sin(d*x + c) + 1) - ((A + B)*a^2 + 2*(A + B)*a*b + (A + B)*b^2)*log(-sin 
(d*x + c) + 1) - 2*(2*B*a*b + A*b^2)*sin(d*x + c))/d
 
3.16.40.6 Sympy [F]

\[ \int \sec (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=\int \left (A + B \sin {\left (c + d x \right )}\right ) \left (a + b \sin {\left (c + d x \right )}\right )^{2} \sec {\left (c + d x \right )}\, dx \]

input
integrate(sec(d*x+c)*(a+b*sin(d*x+c))**2*(A+B*sin(d*x+c)),x)
 
output
Integral((A + B*sin(c + d*x))*(a + b*sin(c + d*x))**2*sec(c + d*x), x)
 
3.16.40.7 Maxima [A] (verification not implemented)

Time = 0.20 (sec) , antiderivative size = 109, normalized size of antiderivative = 1.16 \[ \int \sec (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=-\frac {B b^{2} \sin \left (d x + c\right )^{2} - {\left ({\left (A - B\right )} a^{2} - 2 \, {\left (A - B\right )} a b + {\left (A - B\right )} b^{2}\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) + {\left ({\left (A + B\right )} a^{2} + 2 \, {\left (A + B\right )} a b + {\left (A + B\right )} b^{2}\right )} \log \left (\sin \left (d x + c\right ) - 1\right ) + 2 \, {\left (2 \, B a b + A b^{2}\right )} \sin \left (d x + c\right )}{2 \, d} \]

input
integrate(sec(d*x+c)*(a+b*sin(d*x+c))^2*(A+B*sin(d*x+c)),x, algorithm="max 
ima")
 
output
-1/2*(B*b^2*sin(d*x + c)^2 - ((A - B)*a^2 - 2*(A - B)*a*b + (A - B)*b^2)*l 
og(sin(d*x + c) + 1) + ((A + B)*a^2 + 2*(A + B)*a*b + (A + B)*b^2)*log(sin 
(d*x + c) - 1) + 2*(2*B*a*b + A*b^2)*sin(d*x + c))/d
 
3.16.40.8 Giac [A] (verification not implemented)

Time = 0.40 (sec) , antiderivative size = 129, normalized size of antiderivative = 1.37 \[ \int \sec (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=-\frac {B b^{2} \sin \left (d x + c\right )^{2} + 4 \, B a b \sin \left (d x + c\right ) + 2 \, A b^{2} \sin \left (d x + c\right ) - {\left (A a^{2} - B a^{2} - 2 \, A a b + 2 \, B a b + A b^{2} - B b^{2}\right )} \log \left ({\left | \sin \left (d x + c\right ) + 1 \right |}\right ) + {\left (A a^{2} + B a^{2} + 2 \, A a b + 2 \, B a b + A b^{2} + B b^{2}\right )} \log \left ({\left | \sin \left (d x + c\right ) - 1 \right |}\right )}{2 \, d} \]

input
integrate(sec(d*x+c)*(a+b*sin(d*x+c))^2*(A+B*sin(d*x+c)),x, algorithm="gia 
c")
 
output
-1/2*(B*b^2*sin(d*x + c)^2 + 4*B*a*b*sin(d*x + c) + 2*A*b^2*sin(d*x + c) - 
 (A*a^2 - B*a^2 - 2*A*a*b + 2*B*a*b + A*b^2 - B*b^2)*log(abs(sin(d*x + c) 
+ 1)) + (A*a^2 + B*a^2 + 2*A*a*b + 2*B*a*b + A*b^2 + B*b^2)*log(abs(sin(d* 
x + c) - 1)))/d
 
3.16.40.9 Mupad [B] (verification not implemented)

Time = 12.43 (sec) , antiderivative size = 80, normalized size of antiderivative = 0.85 \[ \int \sec (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=-\frac {\sin \left (c+d\,x\right )\,\left (A\,b^2+2\,B\,a\,b\right )+\frac {\ln \left (\sin \left (c+d\,x\right )-1\right )\,{\left (a+b\right )}^2\,\left (A+B\right )}{2}+\frac {B\,b^2\,{\sin \left (c+d\,x\right )}^2}{2}-\frac {\ln \left (\sin \left (c+d\,x\right )+1\right )\,\left (A-B\right )\,{\left (a-b\right )}^2}{2}}{d} \]

input
int(((A + B*sin(c + d*x))*(a + b*sin(c + d*x))^2)/cos(c + d*x),x)
 
output
-(sin(c + d*x)*(A*b^2 + 2*B*a*b) + (log(sin(c + d*x) - 1)*(a + b)^2*(A + B 
))/2 + (B*b^2*sin(c + d*x)^2)/2 - (log(sin(c + d*x) + 1)*(A - B)*(a - b)^2 
)/2)/d